package com.cloud.cloudshop.shop.controller;

import com.cloud.cloudshop.shop.service.OrderMessageService;
import com.cloud.cloudshop.util.PageUtils;
import com.cloud.common.entity.OrderMessageEntity;
import com.cloud.common.utils.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Arrays;
import java.util.Map;



/**
 * 
 *
 * @author luoJie
 * @email luoJie@gmail.com
 * @date 2021-03-21 17:35:02
 */
@RestController
@RequestMapping("shop/ordermessage")
public class OrderMessageController {
    @Autowired
    private OrderMessageService orderMessageService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = orderMessageService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    public R info(@PathVariable("id") String id){
		OrderMessageEntity orderMessage = orderMessageService.getById(id);

        return R.ok().put("orderMessage", orderMessage);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    public R save(@RequestBody OrderMessageEntity orderMessage){
		orderMessageService.save(orderMessage);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    public R update(@RequestBody OrderMessageEntity orderMessage){
		orderMessageService.updateById(orderMessage);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    public R delete(@RequestBody String[] ids){
		orderMessageService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
